#include "vector.h"
using namespace std;

namespace czb 
{
	
	void func1()
	{
		vector<int> v;
		v.push_back(1);
		v.push_back(2);
		v.push_back(3);
		v.push_back(4);
		v.push_back(4);
		v.push_back(4);
		v.push_back(4);
		for(auto vv : v)
		{
			cout << vv<<" ";
		}
		cout << endl;
	}

	void func2()
	{
		vector<int> v;
		v.resize(100, 1);
		for (auto vv : v)
		{
			cout << vv << " ";
		}
		v.pop_back();
		v.pop_back();
		v.pop_back();

		cout << endl << v.size();
		v.reserve(100);
		v.resize(10);
		cout << v.capacity() << endl;
		cout << v.size() << endl;
	}
	void func3()
	{
		vector<int> v;
		v.push_back(1);
		v.push_back(2);
		v.push_back(3);
		v.push_back(4);
		v.push_back(4);
		v.push_back(4);
		v.push_back(4);
		vector<int> v1(v);
		for (auto vv : v)
		{
			cout << vv << " ";
		}
		cout << endl;

	}

	void func4()
	{
		int arr[] = { 1,2,3,4,5,6,7,8,9 };
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);
		v1.push_back(4);
		v1.push_back(4);
		v1.push_back(4);
		vector<int>v(arr, arr + 9);
		for (auto vv : v)
		{
			cout << vv << " ";
		}
		cout << endl;
		vector<int>v2(v1.begin(), v1.end());
		for (auto vv : v2)
		{
			cout << vv << " ";
		}
		cout << endl;
	}
	
	void func5()
	{
		vector<int> v1(3,3);
		for (auto vv : v1)
		{
			cout << vv << " ";
		}
		cout << endl;
		vector<int> v2;
		v2 = v1;
		for (auto vv : v1)
		{
			cout << vv << " ";
		}
		cout << endl;
	}


	void func6()
	{
		vector<int> v;
		v.push_back(1);
		auto pos = v.begin();
		for (int i = 0; i < 10; i++)
		{
			if (i % 2 == 0)
			{
				pos = v.insert(pos,i);
			}
		}
		for (auto vv : v)
		{
			cout << vv << " ";
		}
		cout << endl;


		v.push_back(1);
		v.push_back(2);
		v.push_back(1);
		v.push_back(3);
		
		auto begin = v.begin();
		auto end = v.end();
		while (begin != end)
		{
			if (*begin % 2 == 0)
				begin = v.erase(begin);
			else
				++begin;
		}

		for (auto vv : v)
		{
			cout << vv << " ";
		}
		cout << endl;

	}
	void func7()
	{
		vector<int> v;
		v.push_back(10);
		v.push_back(20);
		v.push_back(40);
		v.push_back(70);
		v.push_back(90);

		cout << v[4]<<endl;
	}
}



int main()
{
	czb::func7();

}
